package com.wangbo.box.adapter;


/**
 * 对象适配器
 */
public class ObjectAdapterPattern {

    static class Adaptee{
        void invoke(){
            System.out.println("适配者");
        }
    }

    interface Target{
        int invoke();
    }

    static class Adapter implements Target{

        Adaptee adaptee;

        public Adapter(Adaptee adaptee) {
            this.adaptee = adaptee;
        }

        @Override
        public int invoke() {
            adaptee.invoke();
            return 0;
        }
    }

    public static void main(String[] args) {
        Adaptee adaptee = new Adaptee();
        Adapter adapter = new Adapter(adaptee);
        adapter.invoke();
    }


}
